package homework_java;

import java.sql.Date;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

class MyTicket180405426 {
	private int sid;
	private Date date;
	private int seatNo;
	public int getSid() {
		return sid;
	}
	public void setSid(int sid) {
		this.sid = sid;
	}
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}
	public int getSeatNo() {
		return seatNo;
	}
	public void setSeatNo(int seatNo) {
		this.seatNo = seatNo;
	}
	
}
class Film {
	private HashSet<MyTicket180405426> hashset= new HashSet<>();
	
	public HashSet<MyTicket180405426> getHashset() {
		return hashset;
	}

	public void setHashset(HashSet<MyTicket180405426> hashset) {
		this.hashset = hashset;
	}

	public void printById() {
		List<MyTicket180405426> list = new ArrayList<>();
		
		for(MyTicket180405426 ticket: hashset) {
			if(list.size()==0)
				list.add(ticket);
			else {
				boolean flag = true;
				for(int i=0;i<list.size();i++) {
					if(list.get(i).getSid()>ticket.getSid()) {
						list.add(i, ticket);
						flag = false;
						break;
					}
				}
				if(flag)
					list.add(ticket);
			}
		}
		for(MyTicket180405426 ticket: list) {
			System.out.println(ticket.getSid());
		}
	}
}

public class Demo1 {
    private static String name="1804";
	public static void main(String[] args) {
		Film film = new Film();
		MyTicket180405426 ticket1 = new MyTicket180405426();
		ticket1.setSid(1);
		MyTicket180405426 ticket2 = new MyTicket180405426();
		ticket2.setSid(2);
		MyTicket180405426 ticket3 = new MyTicket180405426();
		ticket3.setSid(3);
		MyTicket180405426 ticket4 = new MyTicket180405426();
		ticket4.setSid(4);
		HashSet<MyTicket180405426> set = new HashSet<>();
		set.add(ticket1);
		set.add(ticket2);
		set.add(ticket3);
		set.add(ticket4);
		film.setHashset(set);
		System.out.println(MyTicket180405426.class.getName()+" "+name);
		film.printById();
	}
}
